/*
 * test.c
 *
 *  Created on: Feb 26, 2015
 *      Author: song
 */
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include "except.h"

Except_t Allocate_failed = { "Allocation failed" };

void* allocate(unsigned n)
{
//	void *ret = malloc(n);
//	if(ret)
//		return ret;
	RAISE(Allocate_failed);
	assert(0);
	return NULL;
}

int main()
{
	char *buf;
	TRY
		buf = allocate(4096);
	EXCEPT(Allocate_failed)
		fprintf(stderr, "can't allocate the buffer\n");
		exit(EXIT_FAILURE);
	END_TRY;

	return 0;
}

